<?php


class LiveStream extends CActiveRecord
{
	
	public static function model($Vgmajjibziuy=__CLASS__)
	{
		return parent::model($Vgmajjibziuy);
	}

	
	public function tableName()
	{
		return 'live_stream';
	}

	
	public function rules()
	{
		
		
		return array(
			array('live_channel_id, stream_url', 'required'),
			array('live_channel_id, resolution_w, resolution_h, bitrate, stream_type, create_user_id, status, server_id, modify_user_id, protocol, ranking_android, ranking_ios, protected', 'numerical', 'integerOnly'=>true),
			array('stream_url', 'length', 'max'=>500),
			array('create_date, modify_date', 'safe'),
			
			
			array('id, live_channel_id, stream_url, resolution_w, resolution_h, bitrate, stream_type, create_date, create_user_id, status, server_id, modify_date, modify_user_id, protocol, ranking_android, ranking_ios, protected', 'safe', 'on'=>'search'),
		);
	}

	
	public function relations()
	{
		
		
		return array(
			'createUser' => array(self::BELONGS_TO, 'BackendUser', 'create_user_id'),
			'modifyUser' => array(self::BELONGS_TO, 'BackendUser', 'modify_user_id'),
			'liveChannel' => array(self::BELONGS_TO, 'LiveChannel', 'live_channel_id'),
		);
	}

	
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'live_channel_id' => 'Live Channel',
			'stream_url' => 'Stream Url',
			'resolution_w' => 'Resolution W',
			'resolution_h' => 'Resolution H',
			'bitrate' => 'Bitrate',
			'stream_type' => 'Stream Type',
			'create_date' => 'Create Date',
			'create_user_id' => 'Create User',
			'status' => 'Status',
			'server_id' => 'Server',
			'modify_date' => 'Modify Date',
			'modify_user_id' => 'Modify User',
			'protocol' => 'Protocol',
			'ranking_android' => 'Ranking Android',
			'ranking_ios' => 'Ranking Ios',
			'protected' => 'Protected',
		);
	}

	
	public function search()
	{
		
		

		$V0v5vsnfxezw=new CDbCriteria;

		$V0v5vsnfxezw->compare('id',$this->id);
		$V0v5vsnfxezw->compare('live_channel_id',$this->live_channel_id);
		$V0v5vsnfxezw->compare('stream_url',$this->stream_url,true);
		$V0v5vsnfxezw->compare('resolution_w',$this->resolution_w);
		$V0v5vsnfxezw->compare('resolution_h',$this->resolution_h);
		$V0v5vsnfxezw->compare('bitrate',$this->bitrate);
		$V0v5vsnfxezw->compare('stream_type',$this->stream_type);
		$V0v5vsnfxezw->compare('create_date',$this->create_date,true);
		$V0v5vsnfxezw->compare('create_user_id',$this->create_user_id);
		$V0v5vsnfxezw->compare('status',$this->status);
		$V0v5vsnfxezw->compare('server_id',$this->server_id);
		$V0v5vsnfxezw->compare('modify_date',$this->modify_date,true);
		$V0v5vsnfxezw->compare('modify_user_id',$this->modify_user_id);
		$V0v5vsnfxezw->compare('protocol',$this->protocol);
		$V0v5vsnfxezw->compare('ranking_android',$this->ranking_android);
		$V0v5vsnfxezw->compare('ranking_ios',$this->ranking_ios);
		$V0v5vsnfxezw->compare('protected',$this->protected);

		return new CActiveDataProvider($this, array(
			'criteria'=>$V0v5vsnfxezw,
		));
	}
}